/*
 * Copyright 2008 p.langer
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * 
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * 	http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package at.ac.tuwien.big.easyholdem.player;

import java.util.Date;

/**
 * <p>
 * A poker player.
 * </p>
 * 
 * <p>
 * Created on 16.01.2008 at 22:25:49.
 * </p>
 * 
 * @author Philip Langer <langer[at]big[dot]tuwien[dot]ac[dot]at>
 */
public class Player {

	public enum Gender {
		
		FEMALE, MALE;
	}

	private long id = -1;
	private String firstName;
	private String lastName;
	private Gender gender;
	private Date dateOfBirth;
	private String userName;
	private String password;

	private int stack = 1000;

	/**
	 * Creates a new player.
	 */
	public Player() {
		super();
	}

	/**
	 * Returns the id.
	 * 
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * Sets the id. This is usually done automatically by the {@link PlayerDAO}.
	 * 
	 * @param id
	 *            the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Returns the first name.
	 * 
	 * @return the first name
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * Sets the first name.
	 * 
	 * @param firstName
	 *            the first name to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * Returns the last name.
	 * 
	 * @return the last name
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * Sets the last name.
	 * 
	 * @param lastName
	 *            the last name to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * Returns the current stack.
	 * 
	 * @return the stack
	 */
	public int getStack() {
		return stack;
	}

	/**
	 * Sets the stack size.
	 * 
	 * @param stack
	 *            the stack to set
	 */
	public void setStack(int stack) {
		if (stack < 0) {
			throw new IllegalArgumentException("Stack must not be negative");
		}
		this.stack = stack;
	}

	/**
	 * Increases the stack size.
	 * 
	 * @param amount
	 *            amount to increase.
	 */
	public void increaseStack(int amount) {
		this.stack += amount;
	}

	/**
	 * Decreases the stack size.
	 * 
	 * @param amount
	 *            amout to decrease.
	 */
	public void decreaseStack(int amount) {
		if (amount > stack) {
			throw new IllegalArgumentException(
					"Stack would be negative after decreasing.");
		}
		this.stack -= amount;
	}

	/**
	 * Returns the user name.
	 * 
	 * @return the user name
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * Sets the user name.
	 * 
	 * @param userName
	 *            the user name to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}

	/**
	 * Returns the gender.
	 * 
	 * @return the gender.
	 */
	public Gender getGender() {
		return gender;
	}

	/**
	 * Sets the gender.
	 * 
	 * @param gender
	 *            the gender to set
	 */
	public void setGender(Gender gender) {
		this.gender = gender;
	}

	/**
	 * Returns the date of birth.
	 * 
	 * @return the date of birth.
	 */
	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	/**
	 * Sets the date of birth.
	 * 
	 * @param dateOfBirth
	 *            the date of birth to set.
	 */
	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	/**
	 * Returns the password.
	 * 
	 * @return the password.
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * Sets the password.
	 * 
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

}
